<?php
namespace Home\Controller;
use Think\Controller;
class ArticleController extends CommonController {
    public function index(){
    	$arts=D('article')->find(I('id'));
    	$this->assign('arts',$arts);
    	$this->catename($cateid);
    	$this->other(I('id'));
    	$this->display();
    }
    public function catename($cateid){
    	$cates=D('cate')->find($cateid);
    	$this->assign('catename',$cates['catename']);
    }
    public function other($id){
    	$article=D('article');
    	$articles=$article->find($id);
        // dump($articles);
    	$this->assign('cateinfo',$articles);
        // $cateid=$articles['cateid'];
        
    	$prevs=$article->where('id<'.$id)->where(array('cateid' => $articles['cateid'] ))->order('id desc')->find();
    	$nexts=$article->where('id>'.$id)->where(array('cateid' => $articles['cateid'] ))->order('id asc')->find();
    	$this->assign('prevs',$prevs);
    	$this->assign('nexts',$nexts);

    }
}